/**
 * 
 */
package com.cnhaimei.vod.net.dq;

/**
 * @author jin001.wu@gmail.com <br>
 * @date 2011-8-28
 * 
 */
public class DQRead extends DQRequest {
	private DQParser parser;
	private int from;
	private int size;

	public DQRead() {
		super();
	}

	public DQRead(DQParser par) {
		this.parser = par;
	}

	@Override
	public void onResponsed() {
	}

	void doRequest(DQManager manger) {
		manger.requestData(parser, from, Math.max(size, 1));
	}

	/**
	 * @return the parser
	 */
	public DQParser getParser() {
		return parser;
	}

	/**
	 * @param parser
	 *            the parser to set
	 */
	public void setParser(DQParser parser) {
		this.parser = parser;
	}

	/**
	 * @return the size
	 */
	public int getSize() {
		return size;
	}

	/**
	 * @return the from
	 */
	public int getFrom() {
		return from;
	}

	/**
	 * @param size
	 *            the size to set
	 */
	public void setRequest(int from, int size) {
		this.from = from;
		this.size = size;
	}

	@Override
	public String description() {
		int snap = -1;
		if (parser != null) {
			snap = parser.getSnap();
		}
		return "dqread snap " + snap + " from " + from + " size " + size;
	}

}
